home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / dev / misc / gms_dev.lha / GMSDev / Source / C / Misc / CurrentTime.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-10-23  |  959 b   |  32 lines

  1. /* Dice: dcc -l0 -mD dpk.o tags.o CurrentTime.c -o CurrentTime
  2. **
  3. ** Run this demo with the IceBreaker debug program and observe the output.
  4. */
  5.  
  6. #include <proto/dpkernel.h>
  7. #include <misc/time.h>
  8. #include <system/debug.h>
  9.  
  10. BYTE *ProgName      = "Current Time";
  11. BYTE *ProgAuthor    = "Paul Manias";
  12. BYTE *ProgDate      = "March 1998";
  13. BYTE *ProgCopyright = "DreamWorld Productions (c) 1996-1998.  Freely distributable.";
  14. BYTE *ProgShort     = "Gets the system time and prints it.";
  15.  
  16. void main(void)
  17. {
  18.   struct Time *date;
  19.  
  20.    if (date = Init(Get(ID_TIME),NULL)) {
  21.       if (Activate(date) IS ERR_OK) {
  22.          DPrintF("System Date:","The date is %d/%d/%d", date->Day, date->Month, date->Year);
  23.          DPrintF("System Date:","The time is %d:%d:%d.%d",date->Hour, date->Minute, date->Second, date->Micro);
  24.       }
  25.       else EMsg("Sorry, could not get the current system time.");
  26.    }
  27.    else EMsg("Could not initialise the Time object.");
  28.  
  29.    Free(date);
  30. }
  31.  
  32.